<%@page import="sun.security.krb5.internal.crypto.crc32"%>
<%@ page language="Java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" import="java.lang.Thread"%>
<%@page errorPage="error.html" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

	<head>
		<base href="<%=basePath%>">
		<title>??</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
	</head>

	<body>
		<jsp:useBean id="regBean" class="cn.dgw.usercontrol.regBean" scope="page">
			<%--封装用户注册信息 --%>
			<jsp:setProperty property="*" name="regBean" />
		</jsp:useBean>
		<!-- 注册 -->
		<jsp:useBean id="CrudUser" scope="page" class="cn.dgw.usercontrol.CrudUser" />
		<%
		//判断用户名是否重复
		CrudUser.setUserinfo(regBean);
		boolean state = CrudUser.queryuser();
		if (state == true) {
			CrudUser.setUserinfo(regBean);
			CrudUser.adduser();
			String str = "<h3>注册成功</h3>";
			out.print(str);
		}else{
			String str = "<h3>用户名重复</h3>";
			out.print(str);
		}
		//---------------------------------
	%>
		<%
		session.invalidate();
	%>
		<script type="text/javascript">
			alert("注册成功");
			window.history.back(); //返回上一页
		</script>

	</body>

</html>